package models.weixin;

import models.UUIDModel;
import models.constants.DeletedStatus;

import javax.persistence.*;
import java.util.Date;
import java.util.List;

/**
 * 公众号管理
 */
@Entity
@Table(name = "wx_weixin_datas")
public class WeixinData extends UUIDModel {

    /**
     * name
     * 名称
     */
    @Column(name = "name")
    public String name;
    /**
     * AppId
     */
    @Column(name = "app_id")
    public String appId;

    /**
     * 密钥
     */
    @Column(name = "app_secure")
    public String appSecure;

    /**
     * Token
     */
    @Column(name = "app_token")
    public String appToken;

    /**
     * appAesKey
     */
    @Column(name = "app_aes_key")
    public String appAesKey;


    /**
     * 商户支付ID
     */
    @Column(name = "mch_id")
    public String mchId;

    /**
     * 商户支付秘钥
     */
    @Column(name = "pay_key")
    public String payKey;

    /**
     * 公众号过期时间
     */
    @Column(name = "expiration_date")
    @Temporal(TemporalType.DATE)
    public Date expirationDate;

    /**
     * ping++ API Key
     */
    @Column(name = "pingpp_api_key")
    public String pingppApiKey;

    /**
     * ping++ Api Id
     */
    @Column(name = "pingpp_api_id")
    public String pingppApiId;

    /**
     * 备注
     */
    @Column(name = "remark")
    public String remark;


    /**
     * 加载所有
     * @return
     */
    public static List<WeixinData>  loadAllWeixinDatas(){
        return WeixinData.find(" deleted = ?" , DeletedStatus.UN_DELETED).fetch();
    }

}
